package com.wanmait.computershop.webController;

import com.wanmait.computershop.dao.WebIndexDao;
import com.wanmait.computershop.dao.WebShowProductDao;
import com.wanmait.computershop.vo.CateGory;
import com.wanmait.computershop.vo.Product;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;
import java.util.List;

@Controller
@RequestMapping("Web")
public class WebShowProductController {
    @GetMapping("showProduct")
    public String showProduct(Integer productType, Model model){

        //传输所有商品信息
        WebShowProductDao webShowProductDao = new WebShowProductDao();
        List<Product> productListByCategory = webShowProductDao.findProductsByCategory(productType);
        model.addAttribute("productListByCategory",productListByCategory);
        return "web/product/showProduct";
    }
}
